LogIt is pretty darn simple to use. Just drag LogItModule and LogItWindow into your project and add a few lines to your App (or whatever you call it) subclass's Open event, and your loggin'! Here's what I have in my current project:
'These first few lines are for the debugging log file.
'See the LogIt module for more information.
If (DebugBuild) Then 'Running in IDE, don't log if in built application.
AmLogging = False
LoggingFormat = "" 'Time, or Ticks, or Microseconds, anything else logs without time stamping.
LoggingToWindow = True 'If True, the log is written to LogItWindow instead of file.
LogImmediately = False 'If True, the log is closed as each line is written to avoid losing lines in the cache.
OpenLog
End
Let's briefly go over these.
The "if" is there so I don't do any logging in my built application.
AmLogging is the master switch; when it's false, or unset (which defaults to false), there will be no logging. This allows you to leave everything else in place.
LoggingFormat defines what kind of timestamping you want. You can use clock time, ticks, or microseconds. For ticks and microseconds, the value displayed is relative to the time the application was started so the displayed values aren't so huge. An empty string turns off timestamping.
LoggingToWindow says to invoke a floating window and write the output there instead of to a file. If it is false, a file is created on your Desktop for each run and named "LogIt_HHMMSS", where HHMMSS is the current time, so you can have multiple log files and know which is which.
LogImmediately causes the file (it's ignored if LoggingToWindow is true) to be opened and closed with each line written. This can really give your disk drive a workout but if you need to be sure that every line is written and nothing is lost upon a crash of your application or the system, or a power failure, then you'll want to set this true. If false, the log is opened when the OpenLog message is sent and closed when the CloseLog is sent to LogIt.
Oh, yeah, you'll probably want to put this in your App (or whatever you call it) subclass's Close event, although the file will be closed anyway, you will miss the "Log closed" entry if you don't call CloseLog:
If AmLogging Then
CloseLog
End
And then, wherever in your code you want a line written, just put:
WriteLog "Whatever you want to say"
If you don't have need of logging in your released application, all you have to do is delete LogItModule and LogItWindow from your project and the IDE will help you clean out all of your calls to WriteLog because each one will produce an error!